package com.example.shopping.service.imp;
import com.example.shopping.entity.User;
import com.example.shopping.mapper.UserMapper;
import com.example.shopping.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * @author xuan 2021/9/16
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public List<User> showUsers() {
        return userMapper.showUsers();
    }

    @Override
    public User selectUser(Integer id) {
        return userMapper.selectUser(id);
    }

    @Override
    public User login(String username, String password) {
        return userMapper.login(username, password);
    }

    @Override
    public User fondUserByUsername(String username) {
        return userMapper.fondUserByUsername(username);
    }

    @Override
    public void register(String username, String password, String nickname) {
        userMapper.register(username, password, nickname);
    }

    @Override
    public void updateNicknameAndPassword(String username, String password, String nickname, String newPassword) {
        userMapper.updateNicknameAndPassword(username, password, nickname, newPassword);
    }
}
